package day08;


import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;

import org.junit.Test;

public class mapTest {
	@Test
	public void mapTest() {
		HashMap<String, String> map = new HashMap<>();
		map.put("CN", "中华人们共和国");
		map.put("US", "美利坚合众国");
		String value1 = map.get("CN");
		System.out.println(value1);
		
		Set<Entry<String, String>> entrySet = map.entrySet();
		for (Entry <String,String> entry: entrySet) {
			String key = entry.getKey();
			String value = entry.getValue();
			System.out.println("key"+ key);
			System.out.println("value"+value);
			
		}
		System.out.println();
		Set<String> keyset = map.keySet();
		for (String key : keyset) {
			System.out.println("key:" + key);
			String value = map.get(key);
			System.out.println("value:" + value);
			
		}
		
	}
}
